package com.xiaohao.communication.service;

import com.xiaohao.communication.bean.GoldCoin;
import com.xiaohao.communication.dao.UserGoldCoinDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserGoldCoinService {


    @Autowired
    UserGoldCoinDao userGoldCoinDao;


    // 查询金币
    public GoldCoin getUsergoldCoin(int id){
        List<GoldCoin> userGoldCoin = userGoldCoinDao.getUserGoldCoin(id);
        GoldCoin goldCoin = userGoldCoin.get(0);
        return goldCoin;
    }

    //增加金币
    public void addUserGoldCoin(GoldCoin goldCoin){
        userGoldCoinDao.addUserGoldCoin(goldCoin);
    }

    //减少金币
    public void reduceUserGoldCoin(GoldCoin goldCoin){
        userGoldCoinDao.reduceUserGoldCoin(goldCoin);
    }
}
